<div class="grid_3 alpha omega r">
  浏览：
</div>
<div class='grid_4 alpha omega filter'>
  <div id="img_div" >
    <%= link_to_function params[:filter].blank? ? "所有" : t(params[:filter]), '', :class => 'link_by_filter' %><%= filter_image_tag%>
    <script>
      $('#img_div .link_by_filter').click(function() {
        $("#imitate_select_div li.li_content[filter='<%= params[:filter] %>']").click();
      })
    </script>
  </div>
  <div class="alpha omega grid_3 loading">
    <%= loading_image_tag %>
  </div>
  <div id="imitate_select_div">
    <div>
      <ul>
        <li class="li_title">默认...</li>
        <li class="li_content" filter="">所有</li>
        <li class="li_content" filter="has_balanced"><%= t :has_balanced %></li>
        <li class="li_title">有进展...</li>
        <li class="li_content" filter="feeded_in_near_one_week"><%= t :feeded_in_near_one_week%></li>
        <li class="li_content" filter="feeded_in_near_half_month"><%= t :feeded_in_near_half_month %></li>
        <li class="li_content" filter="feeded_in_near_one_month"><%= t :feeded_in_near_one_month %></li>
        <li class="li_content" filter="feeded_at_one_month_ago"><%= t :feeded_at_one_month_ago %></li>
        <li class="li_title">无进展...</li>
        <li class="li_content" filter="no_feeded_in_near_one_week"><%= t :no_feeded_in_near_one_week %></li>
        <li class="li_content" filter="no_feeded_in_near_half_month"><%= t :no_feeded_in_near_half_month %></li>
        <li class="li_content" filter="no_feeded_in_near_one_month"><%= t :no_feeded_in_near_one_month %></li>
        <li class="li_title">即将交货...</li>
        <li class="li_content" filter="delivered_near_one_week"><%= t :delivered_near_one_week %></li>
        <li class="li_content" filter="delivered_near_half_month"><%= t :delivered_near_half_month %></li>
        <li class="li_content" filter="delivered_near_one_month"><%= t :delivered_near_one_month %></li>
        <li class="li_content" filter="delivered_after_one_month"><%= t :delivered_after_one_month %></li>
        <li class="li_content" filter="delivered_on"><%= t :delivered_on %></li>
        <li class="li_title">逾期交货...</li>
        <li class="li_content" filter="overdue_delivered_near_one_week"><%= t :overdue_delivered_near_one_week %></li>
        <li class="li_content" filter="overdue_delivered_near_half_month"><%= t :overdue_delivered_near_half_month %></li>
        <li class="li_content" filter="overdue_delivered_near_one_month"><%= t :overdue_delivered_near_one_month %></li>
        <li class="li_content" filter="overdue_delivered_more_than_one_month"><%= t :overdue_delivered_more_than_one_month %></li>
        <li class="li_content" filter="overdue_delivered_on"><%= t :overdue_delivered_on %></li>
        <li class="li_title">上门安装...</li>
        <li class="li_content" filter="installed_in_near_one_week"><%=  t :installed_in_near_one_week %></li>
        <li class="li_content" filter="installed_in_near_half_month"><%= t :installed_in_near_half_month %></li>
        <li class="li_content" filter="installed_in_near_one_month"><%= t :installed_in_near_one_month %></li>
        <li class="li_content" filter="installed_at_one_month_ago"><%= t :installed_at_one_month_ago %></li>
        <li class="li_content" filter="installed_on"><%= t :installed_on %></li>
        <li class="li_title">售后服务...</li>
        <li class="li_content" filter="after_serviced_in_near_one_week"><%= t :after_serviced_in_near_one_week %></li>
        <li class="li_content" filter="after_serviced_in_near_half_month"><%= t :after_serviced_in_near_half_month %></li>
        <li class="li_content" filter="after_serviced_in_near_one_month"><%= t :after_serviced_in_near_one_month %></li>
        <li class="li_content" filter="after_serviced_at_one_month_ago"><%= t :after_serviced_at_one_month_ago %></li>
        <li class="li_content" filter="after_serviced_on"><%= t :after_serviced_on %></li>
        <li class="li_title">厂家订做...</li>
        <li class="li_content" filter="order_made_in_near_one_week"><%= t :order_made_in_near_one_week %></li>
        <li class="li_content" filter="order_made_in_near_half_month"><%= t :order_made_in_near_half_month %></li>
        <li class="li_content" filter="order_made_in_near_one_month"><%= t :order_made_in_near_one_month %></li>
        <li class="li_content" filter="order_made_at_one_month_ago"><%= t :order_made_at_one_month_ago %></li>
        <li class="li_content" filter="order_made_on"><%= t :order_made_on %></li>
        <li class="li_title">支付订做款...</li>
        <li class="li_content" filter="payed_in_near_one_week"><%= t :payed_in_near_one_week %></li>
        <li class="li_content" filter="payed_in_near_half_month"><%= t :payed_in_near_half_month %></li>
        <li class="li_content" filter="payed_in_near_one_month"><%= t :payed_in_near_one_month %></li>
        <li class="li_content" filter=":payed_in_near_one_month"><%= t :payed_at_one_month_ago %></li>
        <li class="li_content" filter="payed_on"><%= t :payed_on %></li>
        <li class="li_title">入库登记...</li>
        <li class="li_content" filter="entered_in_near_one_week"><%= t :entered_in_near_one_week %></li>
        <li class="li_content" filter="entered_in_near_half_month"><%= t :entered_in_near_half_month %></li>
        <li class="li_content" filter="entered_in_near_one_month"><%= t :entered_in_near_one_month %></li>
        <li class="li_content" filter="entered_at_one_month_ago"><%= t :entered_at_one_month_ago %></li>
        <li class="li_content" filter="entered_on"><%= t :entered_on %></li>
        <li class="li_title">预订...</li>
        <li class="li_content" filter="ordered_in_near_one_week"><%= t :ordered_in_near_one_week %></li>
        <li class="li_content" filter="ordered_in_near_half_month"><%= t :ordered_in_near_half_month %></li>
        <li class="li_content" filter="ordered_in_near_one_month"><%= t :ordered_in_near_one_month %></li>
        <li class="li_content" filter="ordered_at_one_month_ago"><%= t :ordered_at_one_month_ago %></li>
        <li class="li_content" filter="ordered_on"><%= t :ordered_on %></li>
        <li class="li_title">归档...</li>
        <li class="li_content" filter="filed_in_near_one_week"><%= t :filed_in_near_one_week %></li>
        <li class="li_content" filter="filed_in_near_half_month"><%= t :filed_in_near_half_month %></li>
        <li class="li_content" filter="filed_in_near_one_month"><%= t :filed_in_near_one_month %></li>
        <li class="li_content" filter="filed_at_one_month_ago"><%= t :filed_at_one_month_ago %></li>
        <li class="li_content" filter="filed_on"><%= t :filed_on %></li>
        <li class="li_title">作废...</li>
        <li class="li_content" filter="blanked_out_in_near_one_week"><%= t :blanked_out_in_near_one_week %></li>
        <li class="li_content" filter="blanked_out_in_near_half_month"><%= t :blanked_out_in_near_half_month %></li>
        <li class="li_content" filter="blanked_out_in_near_one_month"><%= t :blanked_out_in_near_one_month %></li>
        <li class="li_content" filter="blanked_out_at_one_month_ago"><%= t :blanked_out_at_one_month_ago %></li>
        <li class="li_content" filter="blanked_out_on"><%= t :blanked_out_on %></li>
      </ul>
    </div>
  </div>
  <%= link_to '导出电子表格',
        orders_url(:filter => params[:filter], :on => params[:on],:status_request => params[:status_request], :format => :xls),
        :title => '导出电子表格',
        :class => :to_excel,
        :target => :_blank
   %>
</div>
<script>
 
   $('#down_png').click( function() {
      $('#imitate_select_div').toggle('fast');
   });

   $('li.li_content').click(function(){
       if(/_on$/.exec($(this).attr('filter'))){
        $.ajax({
           url: "<%= xxed_on_orders_url %>",
           data: {
              filter:$(this).attr('filter')
           },
           beforeSend: function() {
              $('#imitate_select_div').hide();
              $('#img_div').hide();
              $('#orders .filter div.loading').show();
           },
           complete : function() {
              $('#img_div').show();
              $('#orders .filter div.loading').hide();
           }
         });
      }else{
        $.ajax({
           url:"<%= orders_url %>",
           data: {
              filter:$(this).attr('filter'),
              format: 'js'
           },
           beforeSend: function() {
              $('#imitate_select_div').hide();
              $('#img_div').html("<%= escape_javascript loading_image_tag  %>");              
           }
         });
      }
   });

 
</script>
